Component({
    properties: {},
    data: {
        cards: [
            { text: 'Card 1' },
            { text: 'Card 2' },
            { text: 'Card 3' },
            { text: 'Card 4444' },
            { text: 'Card 55555' },
            { text: 'Card 6' },
            { text: 'Card 7' },
            { text: 'Card 8' }
        ],
        selectedCardIndexes: []
    },
    methods: {
        selectCard(e) {
            const index = e.currentTarget.dataset.index
            const selectedCardIndexes = this.data.selectedCardIndexes
            if (selectedCardIndexes.includes(index)) {
                selectedCardIndexes.splice(selectedCardIndexes.indexOf(index), 1)
            } else {
                selectedCardIndexes.push(index)
            }

            this.setData({
                selectedCardIndexes
            })
        }
    }
});
